extends "../xinnong-2/xinnong-2.gd"


func _extInit():
	._extInit()
	lv = 3             #等级的设置
	addSkill("<唯一>预知死生祸福，我方所有角色受到致命伤害时，25%概率将其免疫并获得1层<无敌>，\n可无限触发判定", "幽蝶之梦")

func _onBattleStart():
	._onBattleStart()
	ydzm()

func ydzm():
	var chas = getAllChas(2)
	for i in chas:
		if not i.hasBuff("b_shinano") && not i.isSumm:
			castBuff(i, b_shinano.new())
	
class b_shinano:
	extends "../../../../azurlane_ctrl/AzurBuff.gd"
	var p = 25
	func _init():
		attInit()
		id = "b_shinano"
		buffName = "幽蝶之梦"
		dispel = 2
	func _connect():
		masCha.connect("onHurtDeath", self, "onHurtDeath")
		if casCha.upgraded == 1:
			p = 30
	func onHurtDeath(atkInfo):
		if atkInfo.hurtChaDead and masCha.hasBuff("b_wudi") == null and sys.rndPer(p):
			atkInfo.hurtChaDead = false
			utils.createSkillTextEff("幽蝶之梦", masCha.position)
			masCha.addBuff(buff.b_wudi.new(1))